/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.oneCommerce.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Aymen
 */
@Entity
@Table(name = "ITEM", catalog = "", schema = "AYMEN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Item.findAll", query = "SELECT i FROM Item i"),
    @NamedQuery(name = "Item.findByIditem", query = "SELECT i FROM Item i WHERE i.iditem = :iditem"),
    @NamedQuery(name = "Item.findByNomitem", query = "SELECT i FROM Item i WHERE i.nomitem = :nomitem"),
    @NamedQuery(name = "Item.findByQuantiteitem", query = "SELECT i FROM Item i WHERE i.quantiteitem = :quantiteitem"),
    @NamedQuery(name = "Item.findBySeuilmin", query = "SELECT i FROM Item i WHERE i.seuilmin = :seuilmin"),
    @NamedQuery(name = "Item.findByQuantitecommande", query = "SELECT i FROM Item i WHERE i.quantitecommande = :quantitecommande"),
    @NamedQuery(name = "Item.findByDesccourte", query = "SELECT i FROM Item i WHERE i.desccourte = :desccourte"),
    @NamedQuery(name = "Item.findByDescdetail", query = "SELECT i FROM Item i WHERE i.descdetail = :descdetail")})
public class Item implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDITEM", nullable = false)
    @GeneratedValue(strategy= GenerationType.AUTO)
    private BigDecimal iditem;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "NOMITEM", nullable = false, length = 50)
    private String nomitem;
    @Basic(optional = false)
    @NotNull
    @Column(name = "QUANTITEITEM", nullable = false)
    private BigInteger quantiteitem;
    @Basic(optional = false)
    @NotNull
    @Column(name = "SEUILMIN", nullable = false)
    private BigInteger seuilmin;
    @Basic(optional = false)
    @NotNull
    @Column(name = "QUANTITECOMMANDE", nullable = false)
    private BigInteger quantitecommande;
    @Size(max = 50)
    @Column(name = "DESCCOURTE", length = 50)
    private String desccourte;
    @Size(max = 50)
    @Column(name = "DESCDETAIL", length = 50)
    private String descdetail;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "iditem")
    private Collection<Caracteristique> caracteristiqueCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "iditem")
    private Collection<Prix> prixCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "iditem")
    private Collection<Commandeclient> commandeclientCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "iditem")
    private Collection<Commandefour> commandefourCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "iditem")
    private Collection<Photos> photosCollection;

    public Item() {
    }

    public Item(BigDecimal iditem) {
        this.iditem = iditem;
    }

    public Item(BigDecimal iditem, String nomitem, BigInteger quantiteitem, BigInteger seuilmin, BigInteger quantitecommande) {
        this.iditem = iditem;
        this.nomitem = nomitem;
        this.quantiteitem = quantiteitem;
        this.seuilmin = seuilmin;
        this.quantitecommande = quantitecommande;
    }

    public BigDecimal getIditem() {
        return iditem;
    }

    public void setIditem(BigDecimal iditem) {
        this.iditem = iditem;
    }

    public String getNomitem() {
        return nomitem;
    }

    public void setNomitem(String nomitem) {
        this.nomitem = nomitem;
    }

    public BigInteger getQuantiteitem() {
        return quantiteitem;
    }

    public void setQuantiteitem(BigInteger quantiteitem) {
        this.quantiteitem = quantiteitem;
    }

    public BigInteger getSeuilmin() {
        return seuilmin;
    }

    public void setSeuilmin(BigInteger seuilmin) {
        this.seuilmin = seuilmin;
    }

    public BigInteger getQuantitecommande() {
        return quantitecommande;
    }

    public void setQuantitecommande(BigInteger quantitecommande) {
        this.quantitecommande = quantitecommande;
    }

    public String getDesccourte() {
        return desccourte;
    }

    public void setDesccourte(String desccourte) {
        this.desccourte = desccourte;
    }

    public String getDescdetail() {
        return descdetail;
    }

    public void setDescdetail(String descdetail) {
        this.descdetail = descdetail;
    }

    @XmlTransient
    public Collection<Caracteristique> getCaracteristiqueCollection() {
        return caracteristiqueCollection;
    }

    public void setCaracteristiqueCollection(Collection<Caracteristique> caracteristiqueCollection) {
        this.caracteristiqueCollection = caracteristiqueCollection;
    }

    @XmlTransient
    public Collection<Prix> getPrixCollection() {
        return prixCollection;
    }

    public void setPrixCollection(Collection<Prix> prixCollection) {
        this.prixCollection = prixCollection;
    }

    @XmlTransient
    public Collection<Commandeclient> getCommandeclientCollection() {
        return commandeclientCollection;
    }

    public void setCommandeclientCollection(Collection<Commandeclient> commandeclientCollection) {
        this.commandeclientCollection = commandeclientCollection;
    }

    @XmlTransient
    public Collection<Commandefour> getCommandefourCollection() {
        return commandefourCollection;
    }

    public void setCommandefourCollection(Collection<Commandefour> commandefourCollection) {
        this.commandefourCollection = commandefourCollection;
    }

    @XmlTransient
    public Collection<Photos> getPhotosCollection() {
        return photosCollection;
    }

    public void setPhotosCollection(Collection<Photos> photosCollection) {
        this.photosCollection = photosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iditem != null ? iditem.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Item)) {
            return false;
        }
        Item other = (Item) object;
        if ((this.iditem == null && other.iditem != null) || (this.iditem != null && !this.iditem.equals(other.iditem))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.oneCommerce.entities.Item[ iditem=" + iditem + " ]";
    }
    
}
